const { use } = require("..//config/db_config");
const mysql_model = require("../model/users_mysql");
const mongo_model = require("../model/users_mongo");
const model = use == "mysql" ? mysql_model : mongo_model;
console.log("use=>", use);
class UsersService {
    constructor() {}
    login(data) {
        return new Promise(async(resolve, reject) => {
            try {
                const result = await model.login(data);
                resolve(result)
            } catch (err) {
                reject(err);
            }
        })
    }
    findByUsername(username) {
        return new Promise(async(resolve, reject) => {
            try {
                const result = await model.findByUsername(username);
                resolve(result)
            } catch (err) {
                reject(err);
            }
        })
    }
    reg(data) {
        return new Promise(async(resolve, reject) => {
            try {
                const result = await model.reg(data);
                resolve(result)
            } catch (err) {
                reject(err);
            }
        })
    }
}
module.exports = new UsersService();